<?php
/**
 * 周舟 hzboye010@163.com
 * addby sublime snippets
 * 帖子标签 测试类
 */
namespace app\test\controller;

use app\utils\BoyeService;
use app\test\controller\Ava;
class Tag extends Ava{

  //标签添加
  public function addAll(){
		if(IS_AJAX){

		  $data = [
				'uid'       =>I('post.uid',''),
				'tag_name'  =>I('post.tag_name',''),
				'tid'       =>I('post.tid',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_Tag_addAll',
		  ];
		  $service = new BoyeService();
		  $result = $service->callRemote("",$data,true);
		  return $this->parseResult($result);

		}else{
		  $this->assign('type','BY_Tag_addAll');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['uid',50,LL('need-mark user ID')],
		    ['tag_name','love',LL('need-mark tag name')],
		    ['tid','',LL('thread ID')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
  //标签获取
  public function finds(){
  	if(IS_AJAX){
		  $data = [
				'uid'       =>I('post.uid',''),
				'sort'      =>I('post.sort',''),
				'number'    =>I('post.number',''),
		    'api_ver'   =>$this->api_ver,
		    'notify_id' =>$this->notify_id,
		    'alg'       =>$this->alg,
		    'type'      =>'BY_Tag_finds',
		  ];
		  $service = new BoyeService();
		  $result = $service->callRemote("",$data,true);
		  return $this->parseResult($result);

		}else{
		  $this->assign('type','BY_Tag_finds');
		  $this->assign('field',[
		    ['api_ver',$this->api_ver,LL('need-mark api version')],
		    ['uid',50,LL('user ID')],
		    ['sort',1,LL('need-mark tag-type')],
		    ['number',10,LL('tag count')],
		  ]);
		  echo $this->display('ava/test');
		}
  }
}